package com.ysdcrm.crm.mapper;

import java.util.List;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ysdcrm.crm.model.Clocks;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

public interface IClocksMapper extends BaseMapper<Clocks>{
    @Select("<script>select c.cid,c.status,c.clock_time,u.name uname from clocks c,users u where c.uid = u.uid and TO_DAYS(clock_time) = TO_DAYS(now()) <if test=\"uname!=null and uname!='' \"> and u.name like '%${uname}%'</if><if test=\"rangeTime!=null and rangeTime[0]!=''\"> and clock_time between #{rangeTime[0]} and #{rangeTime[1]}</if><if test=\"status!=null\"> and c.status = #{status}</if></script>")
    List<Clocks> findToday(Clocks c);

    @Insert("insert into clocks(uid,status) values(#{uid},#{status})")
    int clock(Clocks c);
}
